import request from '@/utils/request'

/**
 * 一杆一档基本信息查询
 * @param {string} pillarCode
 */
export function getPillarInfo(query) {
  return request({
    url: '/basic/pillar/findBasicInfoByCode',
    method: 'get',
    params: query
  })
}
// 新版
export function newPillarInfo(query) {
  return request({
    url: '/basic/pillar/findBasicInfoAndFileRecByCode',
    method: 'get',
    params: query
  })
}
/**
 * 关键设备基本信息查询
 * @param {string} deviceCode
 */
export function getJcwDeviceInfo(query) {
  return request({
    url: '/basic/jcwDevice/findBasicInfoByDeviceCode',
    method: 'get',
    params: query
  })
}
/**
 * 锚段基本信息查询
 * @param {string} anchorCode
 */
export function getAnchorInfo(query) {
  return request({
    url: '/basic/anchor/findBasicInfoByAnchorCode',
    method: 'get',
    params: query
  })
}
/**
 * 一杆一档&关键设备关联基本检修情况查询
 * @param {string} devClassCode
 * @param {string} pillarCode || deviceCode
 */
export function getOverhaul(query) {
  return request({
    url: '/basic/deviceLog/pillarOverhaulByCode',
    method: 'get',
    params: query
  })
}
/**
 * 一杆一档&关键设备时间轴查询
 * @param {string} devClassCode
 * @param {string} pillarCode || deviceCode
 */
export function getAllLog(query) {
  return request({
    url: '/basic/deviceLog/findTimeAxisByCode',
    method: 'get',
    params: query
  })
}
/**
 * 一杆一档关联设备查询
 * @param {string} devClassCode
 * @param {string} pillarCode
 */
export function getDevice(query) {
  return request({
    url: '/basic/pillar/devicesByPillarCode',
    method: 'get',
    params: query
  })
}
export function getDeviceNew(query) {
  return request({
    url: '/basic/pillar/devicesByPillarCodeNew',
    method: 'get',
    params: query
  })
}
/**
 * 一杆一档关联零部件
 * @param {string} pillarCode
 */
export function getParts(query) {
  return request({
    url: '/basic/devicepart/findPartByPillarCode',
    method: 'get',
    params: query
  })
}
// 设备布置图
export function getPartDraw(query) {
  return request({
    url: '/basic/pillar/assemblyDrawByPillarCode',
    method: 'get',
    params: query
  })
}
/**
 * 一杆一档详细信息
 * @param {string} pillarCode
 */
export function getDetail(query) {
  return request({
    url: '/basic/pillar/pillarDetails',
    method: 'get',
    params: query
  })
}
/**
 * 关键设备支柱信息查询
 * @param {string} deviceCode
 */
export function getDevicePillar(query) {
  return request({
    url: '/basic/jcwDevice/pillarsByDeviceCode',
    method: 'get',
    params: query
  })
}

export function getJcwDeviceInfoNew(query) {
  return request({
    url: '/basic/jcwDevice/findBasicInfoByDeviceCodeNew',
    method: 'get',
    params: query
  })
}
// 关键设备状态、属性信息
export function getDeviceProp(query) {
  return request({
    url: '/basic/jcwDevAttr/devicePropertiesInfo',
    method: 'get',
    params: query
  })
}
/**
 * 锚段关联支柱信息查询
 * @param {string} deviceCode
 */
export function getAnchorPillar(query) {
  return request({
    url: '/basic/anchor/pillarsByAnchorCode',
    method: 'get',
    params: query
  })
}
export function getAnchorPillarPage(query) {
  return request({
    url: '/basic/anchor/pillarPagesByAnchorCode',
    method: 'get',
    params: query
  })
}
/**
 * 一杆一档图纸资料查询
 * @param {string} pillarCode
 */
export function getPillarCadData(query) {
  return request({
    url: '/basic/pillar/drawsByPillarCode',
    method: 'get',
    params: query
  })
}
/**
 * 关键设备图纸资料查询
 * @param {string} deviceCode
 */
export function getDeviceCadData(query) {
  return request({
    url: '/basic/jcwDevice/drawsByDeviceCode',
    method: 'get',
    params: query
  })
}
/**
 * 线路下拉框
 */
// export function line(query) {
//   return request({
//     url: '/basic/line/',
//     method: 'get',
//     params: query
//   })
// }
/**
 * 区间下拉框
 */
// export function listByLineId(lineId) {
//   return request({
//     url: '/basic/lineSite/listByLineId/' + lineId,
//     method: 'get'
//   })
// }
/**
 * 部门关联的线路下拉框
 */
export function line(query) {
  return request({
    url: '/phm/analysisTarget/getLineListByDept',
    method: 'get',
    params: query
  })
}
/**
 * 部门关联的区间下拉框
 */
export function listByLineId(query) {
  return request({
    url: '/phm/analysisTarget/getSiteListByDept',
    method: 'get',
    params: query
  })
}
/**
 * 部门下拉框
 */
export function dept(query) {
  return request({
    url: '/sysm/share/dept/',
    method: 'get',
    params: query
  })
}

/**
 * 部门下拉框
 */
export function deptTree(query) {
  return request({
    url: '/cms/dept/tree/',
    method: 'get',
    params: query
  })
}

/**
 * 行别下拉框
 */
export function listDirection(query) {
  return request({
    url: '/basic/direction/list',
    method: 'get',
    params: query
  })
}
/**
 * 锚段下拉框
 * lineId, siteIds
 */
export function listAnchor(query) {
  return request({
    url: '/basic/anchor/listAll',
    method: 'get',
    params: query
  })
}
/**
 * 上级线路下拉框
 */
export function lineTree(query) {
  return request({
    url: '/basic/line/lineTree',
    method: 'get',
    params: query
  })
}
/**
 * 所有设备分类类型
 */
export function getAllJcwDevClass(query) {
  return request({
    url: '/basic/jcwDevClass/findAllJcwDevClasss',
    method: 'get',
    params: query
  })
}
/**
 * 所有设备状态
 */
export function getAllJcwDevStatus(query) {
  return request({
    url: '/phm/analysisDefectNum/devStatus',
    method: 'get',
    params: query
  })
}
/**
 * 根据车间、工区、线路、区间站场、设备分类不同维度，查询设备总数
 * @param workshopId (String)
 * @param deptId (String)
 * @param lineId (String)
 * @param siteId (String)
 * @param devClassId (String)
 */
export function getJcwDevCount(query) {
  return request({
    url: '/basic/jcwDevice/countDevices',
    method: 'get',
    params: query
  })
}
/**
 * 设备列表分页查询
 * @param workshopId (String)
 * @param deptId (String)
 * @param lineId (String)
 * @param siteId (String)
 * @param devClassId (String)
 * @param beginRunDate (String) 开始投运时间yyyy-mm-dd
 * @param endRunDate (String) 结束投运时间yyyy-mm-dd
 * @param mrfs (String) 生产厂商
 */
export function getJcwDevPages(query) {
  return request({
    url: '/basic/jcwDevice/devicePages',
    method: 'get',
    params: query
  })
}
/**
 * 设备运行年限分析
 * @param workshopId (String)
 * @param deptId (String)
 * @param lineId (String)
 * @param siteId (String)
 * @param devClassId (String) 多个以逗号分割
 * @return 数量: [1年以下、1-3年、3-5年、5年以上],百分比: [1年以下、1-3年、3-5年、5年以上]
 */
export function getDevRunDate(query) {
  return request({
    url: '/basic/jcwDevice/deviceRunDateAnalysis',
    method: 'get',
    params: query
  })
}
/**
 * 线路基本信息
 * @param lineCode (String)
 */
export function getLineInfo(query) {
  return request({
    url: '/basic/line/lineBaseInfoNums',
    method: 'get',
    params: query
  })
}
/**
 * 区间站场基本信息
 * @param lineSiteCode (String)
 */
export function getSiteInfo(query) {
  return request({
    url: '/basic/lineSite/lineSiteBaseInfoNums',
    method: 'get',
    params: query
  })
}

/**
 * linesite_线路的所有区间站场的跳闸、缺陷、故障数量
 * @param lineId (String)
 */
export function getLineDefectNums(query) {
  return request({
    url: '/basic/lineSite/lineSiteOtherNums',
    method: 'get',
    params: query
  })
}
/**
 * anchor_区间站场所有锚段的告警、缺陷、故障数量
 * @param lineSiteCode (String)
 */
export function getSiteDefectNums(query) {
  return request({
    url: '/basic/anchor/anchorsOtherNums',
    method: 'get',
    params: query
  })
}
/**
 * 获取参数异常类型列表
 */
export function getDefectTypeList() {
  return request({
    url: '/phm/analysisParamDefectNum/findAllDefectType',
    method: 'get'
  })
}
/**
 * 获取关键设备图片
 */
export function getDevPic(query) {
  return request({
    url: '/dfile/file/listByForeignId',
    method: 'get',
    params: query
  })
}
